package cn.qingyun.gis.modules.scenes.controller;

import cn.qingyun.gis.common.Result;
import cn.qingyun.gis.modules.init.system.base.controller.BasicController;
import cn.qingyun.gis.modules.scenes.entity.PoiScenario;
import cn.qingyun.gis.modules.scenes.request.*;
import cn.qingyun.gis.modules.scenes.service.IPoiInnerService;
import cn.qingyun.gis.modules.scenes.service.IPoiScenarioService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@Api(tags = "对外提供接口--网格通")
@RequestMapping("/inner/app/scenes/")
@RestController
@Slf4j
public class PoiInnerController extends BasicController<PoiScenario, IPoiScenarioService> {

    @Resource
    private IPoiInnerService iPoiInnerService;

    @PostMapping("/poi/poiCount/query")
    @ApiOperation("查询直销人员的首页个数信息")
    public Result<?> poiCountQuery(@Validated @RequestBody String request) {
        return Result.okData(iPoiInnerService.selectPoiCountByKwPhone(request));
    }

    @PostMapping("/poi/business/content/query")
    @ApiOperation("根据工号查询商机信息列表")
    public Result<?> poiBusinessContentQuery(@Validated @RequestBody BusinessContentRequest request) {
        return Result.okData(iPoiInnerService.selectBusinessContent(request));
    }

    @PostMapping("/poi/business/detail/query")
    @ApiOperation("商机详情查看")
    public Result<?> poiBusinessContentDetail(@Validated @RequestBody BusinessDetailRequest request) {
        return Result.okData(iPoiInnerService.selectBusinessContentDetail(request));
    }

    @PostMapping("/poi/business/update")
    @ApiOperation("商机营销状态修改接口")
    public Result<?> updateBusinessState(@Validated @RequestBody BusinessMarketingRequest request) {
        iPoiInnerService.updateBusinessState(request);
        return Result.ok("修改成功！");
    }

    @PostMapping("/audio/record/save")
    @ApiOperation("录音记录存储")
    public Result<?> audioRecordSave(@Validated @RequestBody AudioRequest request) {
        iPoiInnerService.saveAudioRecord(request);
        return Result.ok("保存成功！");
    }
    @PostMapping("/ai/conversation/record/save")
    @ApiOperation("灵犀助手会话记录接口")
    public Result<?> conversationRecordSave(@Validated @RequestBody AiConversationRecordRequest request) {
        iPoiInnerService.aiConversationRecordSave(request);
        return Result.ok("保存成功！");
    }
}
